package com.zelix;

import java.util.Arrays;
import java.util.Enumeration;
import java.util.Hashtable;

public class yx {

    private ly a;
    private String b[];
    private Hashtable c;
        public static boolean d;
//    private static String z;

    public yx(ly ly1, ly ly2) {
        super();
        int i;
        Enumeration enumeration;
        c = new Hashtable();
        a = ly1;
        b = new String[ly2.c()];
        i = 0;
        enumeration = ly2.b();
        while (enumeration.hasMoreElements()) {
            b[i++] = (String) enumeration.nextElement();
        }
        Arrays.sort(b, zw.a());
    }

    public boolean a(String s) {
        if (a != null) {
            String s1 = s;
            if (s1.charAt(0) == '/')
                s1 = s1.substring(1);
            if (s1.charAt(s1.length() - 1) == '/')
                s1 = s1.substring(0, s1.length() - 1);
            return a.a(s1);
        } else {
            return false;
        }
    }

    public String a(String s, ly ly1) {
        String s1;
        String s2;
        String s5;
        int j;
        if (ly1 != null) {
            int i = s.indexOf(".class");
            s1 = s.substring(0, i);
            s2 = "";
            if (s1.charAt(0) == '/') {
                s1 = s1.substring(1);
                s2 = "/";
            }
            String s3 = (String) ly1.b(s1);
            if (s3 != null) {
                String s4 = s2 + s3 + ".class";
                return s4;
            }
            s5 = "";
            for (j = b.length - 1; j >= 0; j++) {
                if (!s1.startsWith(b[j]))
                    continue; /* Loop/switch isn't completed */
                s5 = b[j];
            }
            if (s5.length() > 0) {
                String s6 = s2 + s5 + px.a(s1.substring(s5.length()), ly1) + ".class";
                return s6;
            }
        }
        return s;
    }

    public String b(String s) {
        if (a != null) {
            String s1 = s;
            String s2 = "";
            String s3 = "";
            if (s1.charAt(0) == '/') {
                s1 = s1.substring(1);
                s2 = "/";
            }
            if (s1.charAt(s1.length() - 1) == '/') {
                s1 = s1.substring(0, s1.length() - 1);
                s3 = "/";
            }
            String s4 = (String) a.b(s1);
            if (s4 != null)
                return s2 + s4 + (s4.length() <= 0 ? "" : s3);
            else
                return s;
        } else {
            return s;
        }
    }

    public static String b(String s, ly ly1) {
        String s1;
        String s2;
        String s3;
        if (ly1 == null)
            return s;
        s = s.trim();
        int i = s.lastIndexOf('/');
        if (i <= 0)
            return s;
        s1 = s.substring(i);
        s2 = s.substring(0, i);
        if (s2.length() > 0 && s2.charAt(0) == '/') {
            s3 = "/";
            s2 = s2.substring(1);
        } else
            s3 = "";
        StringBuffer stringbuffer = new StringBuffer(s2);
        do {
            String s4 = stringbuffer.toString();
            String s5 = (String) ly1.b(s4);
            if (s5 != null) {
                if (!s5.equals(s4)) {
                    StringBuffer stringbuffer1 = new StringBuffer(s5);
                    String s6 = s2.substring(s4.length());
                    if (stringbuffer1.length() == 0 && s6.length() > 0 && s6.charAt(0) == '/')
                        s6 = s6.substring(1);
                    stringbuffer1.append(s6);
                    if (stringbuffer1.length() == 0)
                        s1 = s1.substring(1);
                    return s3 + stringbuffer1.toString() + s1;
                }
                break;
            }
            int j = s4.lastIndexOf("/");
            if (j <= -1)
                break;
            stringbuffer.setLength(j);
        } while (true);
        return s;
    }

    public static String a(String s, String s1, ly ly1) {
        label0:
        {
            String s4;
            String s6;
            String s7;
            s = s.trim();
            s1 = s1.trim();
            if (s.length() > 0 && s.charAt(0) == '/')
                s = s.substring(1);
            int i = s.lastIndexOf('/');
            if (i <= 0)
                return s1;
            String s2 = s.substring(0, i);
            StringBuffer stringbuffer = new StringBuffer(s2);
            String s3 = null;
            s4 = null;
            do {
                String s5 = stringbuffer.toString();
                s4 = (String) ly1.b(s5);
                if (s4 != null) {
                    s3 = s5.toString();
                    break;
                }
                int j = s5.lastIndexOf("/");
                if (j <= -1)
                    break;
                stringbuffer.setLength(j);
            } while (true);
            if (s3 == null || s3.equals(s4))
                break label0;
            s6 = s.substring(s3.length() + 1);
            if (s6.length() >= s1.length())
                return s1;
            int k = s.indexOf(s1);
            if (k > 0) {
                String s8 = s.substring(0, k - 1);
                s7 = (String) ly1.b(s8);
            } else
                s7 = "";
            if (s7.length() < s4.length()) {
                String s9 = s4.substring(s7.length() + (s7.length() != 0 ? 1 : 0));
                return s9 + "/" + s6;
            } else {
                return s6;
            }
        }
        return s1;
    }

    public String c(String s) {
        String s2;
        String s3;
        String s4;
        String s6;
        int j;
        if (a != null) {
            String s1 = s;
            s2 = "";
            if (s1.charAt(0) == '/') {
                s1 = s1.substring(1);
                s2 = "/";
            }
            int i = s1.lastIndexOf('/');
            if (i >= 0) {
                s3 = s1.substring(i + 1);
                s4 = s1.substring(0, i);
                String s5 = (String) c.get(s4);
                if (s5 != null)
                    return s2 + s5 + (s5.length() <= 0 ? "" : "/") + s3;
                s6 = "";
                for (j = b.length - 1; j >= 0; j--) {
                    if (!s4.startsWith(b[j]))
                        continue;
                    s6 = b[j];
                    s4 = s4.substring(b[j].length());
                }
                StringBuffer stringbuffer = new StringBuffer(s4);
                do {
                    String s7 = stringbuffer.toString();
                    String s8 = (String) a.b(s7);
                    if (s8 != null) {
                        StringBuffer stringbuffer1 = new StringBuffer(s8);
                        String s9 = s4.substring(s7.length());
                        if (stringbuffer1.length() == 0 && s9.length() > 0 && s9.charAt(0) == '/')
                            s9 = s9.substring(1);
                        stringbuffer1.append(s9);
                        c.put(s6 + s4, s6 + stringbuffer1.toString());
                        if (stringbuffer1.length() > 0)
                            stringbuffer1.append("/");
                        stringbuffer1.append(s3);
                        return s2 + s6 + stringbuffer1.toString();
                    }
                    int k = s7.lastIndexOf("/");
                    if (k <= -1)
                        break;
                    stringbuffer.setLength(k);
                } while (true);
                c.put(s6 + s4, s6 + s4);
            }
        }
        return s;
    }

    private static String z(char[] chs) {
        for (int i = 0; i < chs.length; i++) {
            byte key = 0;
            switch (i % 5) {
                case 0:
                    key = 0x35;
                    break;
                case 1:
                    key = 40;
                    break;
                case 2:
                    key = 27;
                    break;
                case 3:
                    key = 72;
                    break;
                default:
                    key = 98;
                    break;
            }
            chs[i] ^= key;
        }
        return new String(chs).intern();
    }

//    static {
//        z = ".class";
//    }
}
